{% extends "base.html" %}

{% block title %}{{ user.username }}'s Profile{% endblock %}

{% block content %}
{{ user.username }}'s profile!

<p>我的余额:</p>
<table border="1">
	<tr>
		<th>小组</th>
		<th>简介</th>
		<th>我的小组余额</th>
	</tr>
	{% for gm in groups_man %}
	<tr>
		<td><a href="/activity/group/?gid={{ gm.group.id }}">{{ gm.group.name }}</a></td>
		<td>{{ gm.group.description }}</td>
		<td>{{ gm.balance }}</td>
	</tr>
	{% endfor %}
	
	{% for gj in groups_join %}
	<tr>
		<td><a href="/activity/group/?gid={{ gj.group.id }}">{{ gj.group.name }}</a></td>
		<td>{{ gj.group.description }}</td>
		<td>{{ gj.balance }}</td>
	</tr>	
	{% endfor %}
</table>

<p>我参加的小组:</p>
<table border="1">
	<tr>
		<th>小组</th>
		<th>简介</th>
		<th>管理员</th>
		<th>我的小组余额</th>		
	</tr>
	{% for gj in groups_join %}
	<tr>
		<td>{{ gj.group.name }}</td>
		<td>{{ gj.group.description }}</td>
		<td>
			{% for admins in gj_admins %}
			{% if forloop.counter == forloop.parentloop.counter %}
			{% for a in admins %}
			{{ a.username }}
			{% endfor %}
			{% endif %}
			{% endfor %}
		</td>
		<td>{{ gj.balance }}</td>
	</tr>	
	{% endfor %}
</table>
{% endblock %} 
